package com.edu.exam.enums.curriculum.questionbank;

/**
 * 属性类型枚举
 * 
 * 验证规则的属性类型定义
 * 
 * @author System
 * @version 1.0.0
 */
public enum AttributeType {
    CATEGORY("CATEGORY", "分类属性"),
    TAG("TAG", "标签属性"),
    DIFFICULTY("DIFFICULTY", "难度属性"),
    CONTENT("CONTENT", "内容属性"),
    SCORE("SCORE", "分数属性"),
    TIME("TIME", "时间属性"),
    TYPE("TYPE", "类型属性");

    private final String code;
    private final String description;

    AttributeType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AttributeType fromCode(String code) {
        for (AttributeType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return TYPE;
    }
}